package Netzwerkprogrammierung.g1.Sockets;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.ServerSocket;
import java.net.Socket;

public class SimpleTCPServer {
	
	public static void main(String[] args) throws IOException {
		ServerSocket server = new ServerSocket(1234);
		
		//Socket client = new Socket("127.0.0.1",1234);
		
		Socket socket = server.accept();
		
		BufferedReader reader = new BufferedReader(
				new InputStreamReader(socket.getInputStream()));
		
		BufferedWriter writer = new BufferedWriter(
				new OutputStreamWriter(socket.getOutputStream()));
		
		String text = reader.readLine();
		writer.write(text.toUpperCase());
		writer.newLine();
		
		reader.close();
		writer.close();
		socket.close();
	}
}
